<?php
/**
 * Copyright 2011  SURFfoundation
 * 
 * This file is part of ESCAPE.
 * 
 * ESCAPE is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ESCAPE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ESCAPE.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information:
 * http://escapesurf.wordpress.com/
 * http://www.surffoundation.nl/
 * 
 * Contact: d.vierkant@utwente.nl
 * 
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3
 */
?>
<?php
	/* @var $repositoryUi escape_repositoryui_RepositoryUi */
	$repositoryUi =& $this->requestAttributes['repositoryUi'];
	/* @var $aggregations array */
	$aggregations =& $this->requestAttributes['aggregations'];
	
	$templateVariables = array();
	$templateVariables['title'] = 'Manage ' . $repositoryUi->repository->config['label_aggregations'];
	$this->requestAttributes['templateVariables'] =& $templateVariables;
?>
<?php $this->displayHeader(); ?>

<div class="escape_Section">

<div class="escape_SectionTitle"><?php print htmlspecialchars(ucfirst($repositoryUi->repository->config['label_aggregation'])); ?> list</div>

<p>
<a href="<?php print htmlspecialchars($repositoryUi->getActionLinkById('me'))?>">Back</a>
</p>

<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery('#escape_aggregationTable').dataTable({
			"sPaginationType": "full_numbers",
			"iDisplayLength": 25,
			"aaSorting": [[ 2, "asc"]]
		});
	} );
</script>

<table cellpadding="0" cellspacing="0" border="0" class="display" id="escape_aggregationTable">
	<thead>
		<tr>
			<th></th>
			<th width="1">ID</th>
			<th>Title</th>
		</tr>
	</thead>
	<tbody>
<?php
	foreach($aggregations as $aggregation)
	{
		/* @var $aggregation escape_repository_OreAggregation */
		$title = $aggregation->getTitle();
		if($title === null || $title === "")
		{
			$title = 'Unnamed aggregation ' . $aggregation->getId();
		}
?>
	<tr>
		<td style="white-space: nowrap">
			<a href="<?php print htmlspecialchars($repositoryUi->getActionLinkById('show', $aggregation->getId())); ?>"><img src="/rsc/img/doc.gif" alt="Select" /></a>
			<a href="<?php print htmlspecialchars($repositoryUi->getActionLinkById('edit', $aggregation->getId())); ?>"><img src="/rsc/img/edit.gif" alt="Edit" /></a>
			<a href="<?php print htmlspecialchars($repositoryUi->getActionLinkById('delete', $aggregation->getId())); ?>"><img src="/rsc/img/delete.gif" alt="Delete" /></a>
		</td>
		<td>
			<?php print htmlspecialchars($aggregation->getId()); ?>
		</td>
		<td>
			<?php print htmlspecialchars($title); ?>
		</td>
	</tr>
<?php
	}
?>
	</tbody>
	<tfoot>
		<tr>
			<th></th>
			<th>ID</th>
			<th>Title</th>
		</tr>
	</tfoot>
</table>

</div>

<?php $this->displayFooter(); ?>
